package com.countryside.service.impl;

import com.countryside.mapper.UserMapper;
import com.countryside.pojo.User;
import com.countryside.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public int addUser(User user) {
        user.setId(UUID.randomUUID().toString());
        user.setUserImg("logo.png");
        return userMapper.addUser(user);
    }

    @Override
    public User queryUserByUsernameAndPassword(String username,String password) {
        return userMapper.queryUserByUsernameAndPassword(username,password);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public User queryUserByUsername(String username) {
        return null;
    }

    @Override
    public int updateImgByUserId(String id, String userImg) {
        return userMapper.updateImgByUserId(id, userImg);
    }
}
